build: Generate the appropriate GLib versioning checks
authorEmmanuele Bassi <ebassi@gnome.org>
Tue, 18 Apr 2017 13:24:06 +0000 (14:24 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Wed, 3 May 2017 14:10:56 +0000 (15:10 +0100)
The autotools build checks the version of GLib we are depending on in
order to generate the appropriate GLIB_VERSION values for the
min-required/max-allowed defines.

meson.build

index fef52f2ca2bbf3c4fe1b44d029a7959935fd52a1..ca20b0e8c76685cd4c6838f77862dd50f82f1515 100644 (file)
@@ -7,9 +7,23 @@ project('gtk+-4.0', 'c',
         meson_version : '>= 0.39.1',
         license: 'LGPLv2.1+')
 
-glib_req          = '>= 2.49.4'
-glib_min_required = 'GLIB_VERSION_2_48'
-glib_max_allowed  = 'GLIB_VERSION_2_50'
+glib_major_req = 2
+glib_minor_req = 49
+glib_micro_req = 4
+
+if glib_minor_req.is_odd()
+  glib_min_required = 'GLIB_VERSION_@0@_@1@'.format(glib_major_req, glib_minor_req - 1)
+else
+  glib_min_required = 'GLIB_VERSION_@0@_@1@'.format(glib_major_req, glib_minor_req)
+endif
+
+if glib_minor_req.is_odd()
+  glib_max_allowed = 'GLIB_VERSION_@0@_@1@'.format(glib_major_req, glib_minor_req + 1)
+else
+  glib_max_allowed = 'GLIB_VERSION_@0@_@1@'.format(glib_major_req, glib_minor_req)
+endif
+
+glib_req          = '>= @0@.@1@.@2@'.format(glib_major_req, glib_minor_req, glib_micro_req)
 pango_req         = '>= 1.37.3'
 atk_req           = '>= 2.15.1'
 cairo_req         = '>= 1.14.0'